package com.cykj.controller;

import com.cykj.service.PatientService;
import com.cykj.util.ResponseDto;
import com.cykj.vo.PageVo;
import com.cykj.vo.UserIdsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/patient")
public class PatientController {
    @Autowired
    private PatientService patientService;
    @RequestMapping("/getAllPatient")
    public ResponseDto getAllPatient(@RequestBody PageVo vo){
        return patientService.getAllPatient(vo.getPageCurr(), vo.getPageSize());
    }
    @RequestMapping("/deletePatient")
    public ResponseDto deletePatient(int patientId){
        return patientService.deletePatient(patientId);
    }
    @RequestMapping("/alterInfo")
    public ResponseDto alterInfo(int patientId, double patientMoney, int patientHeight, int patientWeight){
        return patientService.alterInfo(patientId, patientMoney, patientHeight, patientWeight);
    }
    @RequestMapping("/selectByData")
    public ResponseDto selectByData(int sort,String value,int pageCurr,int pageSize){
        return patientService.selectByData(sort, value, pageCurr, pageSize);
    }
    @RequestMapping("/deleteUsers")
    public ResponseDto deleteUsers(@RequestBody UserIdsVo vo){
        return patientService.deleteUserByIds(vo.getIds());
    }
    @RequestMapping("/addCommit")
    public ResponseDto addCommit(String name,int age,String phone,String cardID,int height,int weight,String radio){
        return patientService.addCommit(name, age, phone, cardID, height, weight, radio,0);
    }
    @RequestMapping("/selectAgeCount")
    public ResponseDto selectAgeCount(@RequestBody UserIdsVo vo){
        return patientService.selectAgeCount(vo.getAges());
    }
    @RequestMapping("/selectMoneyCount")
    public ResponseDto selectMoneyCount(String age, String time1, String time2){
        return patientService.selectMoneyCount(age, time1, time2);
    }

}
